/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package prak6;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.sql.Statement;

/**
 *
 * @author Imung
 */
public class appConnection {
    Connection conn;
   
    public appConnection(String conn){
        try{
            this.conn = DriverManager.getConnection(conn,"root","");
            System.out.println("Connected");
        }
       
        catch(SQLException ex){
            System.out.println("NOt Connected");
        }
    }
    
        public ResultSet query(String sql){
            ResultSet rs = null;
            try{
                Statement stmt = conn.createStatement();
                rs = stmt.executeQuery(sql);
            }
            catch(SQLException ex){}
            return rs;
            
            }
            
            
        public void dmlQuery(String sql){
                try{
                Statement stmt = conn.createStatement();
                stmt.executeUpdate(sql);
            }
            catch(SQLException ex){}
            
        }
    
}
